package cn.icanci.ladybird.service.util;

import cn.icanci.ladybird.common.result.JsonData;
import com.alipay.api.AlipayApiException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author: icanci
 * @date: Created in 2020/10/13 13:38
 * @classAction: 支付宝支付接口，用来处理支付宝支付
 */
public interface AlipayService {

    /**
     * 支付宝支付调用
     *
     * @param httpResponse 响应
     * @param request      请求
     * @param orderInfoId  订单id
     * @throws IOException 异常
     */
    void alipay(HttpServletResponse httpResponse, HttpServletRequest request, Long orderInfoId) throws IOException;



    /**
     * 支付宝支付调用
     *
     * @param httpResponse 响应
     * @param request      请求
     * @param orderInfoId  订单id
     * @throws IOException 异常
     */
    void toAlipay(HttpServletResponse httpResponse, HttpServletRequest request, Long orderInfoId) throws Exception;

    /**
     * 异步回调，也就是支付之后调用页面实现跳转
     *
     * @param request  请求
     * @param response 响应对象
     * @return 返回JsonData
     * @throws IOException        IO异常
     * @throws AlipayApiException Alipay 支付异常
     */
    JsonData returnUrl(HttpServletRequest request, HttpServletResponse response) throws Exception;
}
